package com.sixth.controller;

import com.sixth.entity.TableResult;
import com.sixth.entity.TbMember;
import com.sixth.service.MemberService;

import com.sixth.until.CommonResult;
import com.sixth.vo.LoginVo;
import com.sixth.vo.MemberVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @program: self-tui-education
 * @description:
 * @author: 厉泽禄
 * @create: 2022-04-15 19:01
 **/
@RestController
@RequestMapping("student/member")
public class MemberController {
    @Autowired
    private MemberService memberService;


    @PostMapping("getStudentAll/{pageNum}/{pageSize}")
    public TableResult getStudentAll(@PathVariable Integer pageNum, @PathVariable Integer pageSize, @RequestBody MemberVo memberVo) {
        System.out.println(memberVo);
        return memberService.getStudentAll(pageNum, pageSize, memberVo);
    }
    @PostMapping("stateChange/{isDisabled}/{id}")
    public CommonResult stateChange(@PathVariable Boolean isDisabled, @PathVariable String id){
        return memberService.stateChange(isDisabled,id);
    }
    @PostMapping("modifyStudentInformation")
    public CommonResult updateInfo(@RequestBody TbMember member){
        return memberService.updateInfo(member);
    }
    @PostMapping("qianLogin")
    public CommonResult qianLogin(@RequestBody LoginVo loginVo){
        return memberService.qianLogin(loginVo);
    }
    @GetMapping("findStudentBymobile/{mobile}")
    public CommonResult findStudentBymobile(@PathVariable String mobile){
        return memberService.findStudentBymobile(mobile);
    }
    @GetMapping("tuichuLogin")
    public CommonResult tuichuLogin(){
        System.out.println("111111");
        return memberService.tuichuLogin();
    }
    @GetMapping("getYanZhengMa/{mobile}")
    public CommonResult getYanZhengMa(@PathVariable String mobile){
        return memberService.getYanZhengMa(mobile);
    }
    @PostMapping("installMember/{mobile}/{qianPassword}")
    public CommonResult installMember(@PathVariable String mobile,@PathVariable String qianPassword){
        return memberService.installMember(mobile,qianPassword);
    }
    @PostMapping("uploadMsg")
    public CommonResult oss(MultipartFile file){
        return memberService.oss(file);
    }
}
